/**
 * @CopyRight weitaming.com
 * @author wuyahui
 * @E-mail wuyahui@ispied.com
 * @version 1.0.0
 * @Date  2014年5月6日 上午11:12:52
 */
package com.tstudy.laoshibang.manager;

import java.sql.SQLException;
import java.util.List;

import com.tstudy.laoshibang.db.DBManagerImpl;
import com.tstudy.laoshibang.mode.CommunityMessage;

public class CommunityMessageManager extends DBManagerImpl {
	private CommunityMessageManager() {
	}

	public static CommunityMessageManager instance = new CommunityMessageManager(CommunityMessage.class);

	private CommunityMessageManager(Class<CommunityMessage> clazz) {
		super(clazz);
	}

	public static CommunityMessageManager getInstance() {
		return instance;
	}
	
	@SuppressWarnings("unchecked")
	public List<CommunityMessage> queryUnRead() {
		List<CommunityMessage> list = null;
		try {
			list =  dao.queryBuilder().orderBy("createTime", false).where().eq("hasRead",0).query();
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return list;
	}
	
	public boolean insertObject(CommunityMessage obj){
		obj.objectToString();
		return insert(obj);
	}

}
